<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
</head>
<body>
<img src="image/male.png">
<script>
  let img = document.querySelector('img');
  img.onclick = function(){
    if(img.src.indexOf('female.png')>=0){
      img.src='image/male.png';
    }else if(img.src.indexOf('male.png')>=0){
      img.src='image/female.png';
    }
  }
</script>
</body>
</html>